﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Twillo.Core.Forms
{
    public partial class frmCredentials : Form
    {
        public string Caption { get { return label3.Text; } set { label3.Text = value; } }
        public string Username { get { return txtUsername.Text; } set { txtUsername.Text = value; } }
        public string Password { get { return txtPassword.Text; } set { txtPassword.Text = value; } }
        public System.Net.NetworkCredential Credentials { get { return new System.Net.NetworkCredential(Username, Password); } }
        public bool RememberCredentials { get { return chkRemember.Checked; } set { chkRemember.Checked = value; } }

        public frmCredentials()
        {
            InitializeComponent();
        }

        private void btnOK_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.OK;
            this.Close();
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.Cancel;
            this.Close();
        }

        private void txtUsername_TextChanged(object sender, EventArgs e)
        {
            btnOK.Enabled = !string.IsNullOrEmpty(txtUsername.Text.Trim());
        }

        private void frmCredentials_Load(object sender, EventArgs e)
        {
            txtUsername.Focus();
            btnOK.Enabled = false;
        }

    }
}
